{% extends "base.html" %}
{% load i18n future mezzanine_tags blog_tags keyword_tags disqus_tags %}

{% block meta_title %}{% if page %}{{ page.meta_title }}{% else %}{% trans "Blog" %}{% endif %}{% endblock %}

{% block meta_keywords %}{% metablock %}
{% keywords_for page as keywords %}
{% for keyword in keywords %}
    {% if not forloop.first %}, {% endif %}
    {{ keyword }}
{% endfor %}
{% endmetablock %}{% endblock %}

{% block meta_description %}{% metablock %}
{{ page.description }}
{% endmetablock %}{% endblock %}

{% block title_wrapper %}
{% endblock %}

{% block breadcrumb_menu %}
{{ block.super }}
{% if tag or category or year or month or author %}
<li>{% spaceless %}
{% if tag %}
    {% trans "Tag:" %} {{ tag }}
{% else %}{% if category %}
    {% trans "Category:" %} {{ category }}
{% else %}{% if year or month %}
    {% if month %}{{ month }}, {% endif %}{{ year }}
{% else %}{% if author %}
    {% trans "Author:" %} {{ author.get_full_name|default:author.username }}
{% endif %}{% endif %}{% endif %}{% endif %}
{% endspaceless %}
</li>
{% endif %}
{% endblock %}

{% block left_wrapper %}
{% endblock %}
<div class="col-md-{% block main_col_size %}8{% endblock %}">
{% block main %}

{% if tag or category or year or month or author %}
    {% block blog_post_list_filterinfo %}
    <p>
    {% if tag %}
        {% trans "Viewing posts tagged" %} {{ tag }}
    {% else %}{% if category %}
        {% trans "Viewing posts for the category" %} {{ category }}
    {% else %}{% if year or month %}
        {% trans "Viewing posts from" %} {% if month %}{{ month }}, {% endif %}
        {{ year }}
    {% else %}{% if author %}
        {% trans "Viewing posts by" %}
        {{ author.get_full_name|default:author.username }}
    {% endif %}{% endif %}{% endif %}{% endif %}
    {% endblock %}
    </p>
{% else %}
    {% if page %}
    {% block blog_post_list_pagecontent %}
    {% if page.get_content_model.content %}
        {% editable page.get_content_model.content %}
        {{ page.get_content_model.content|richtext_filters|safe }}
        {% endeditable %}
    {% endif %}
    {% endblock %}
    {% endif %}
{% endif %}

{% for blog_post in blog_posts.object_list %}
	{% block blog_post_main%}	
	<article>
	<div class="post-image">
			<div class="post-heading">
			{% block blog_post_list_post_title %}
			{% editable blog_post.title %}
			<h3><a href="{{ blog_post.get_absolute_url }}">{{ blog_post.title }}</a></h3>
			{% endeditable %}
			{% endblock %}
			</div>
			{% if settings.BLOG_USE_FEATURED_IMAGE and blog_post.featured_image %}
			{% block blog_post_list_post_featured_image %}
			<a href="{{ blog_post.get_absolute_url }}">
				<img class="" src="{{ MEDIA_URL }}{{blog_post.featured_image}}">
			</a>
			{% endblock %}
			{% endif %}
			
	</div>

{% block blog_post_list_post_content %}
{% editable blog_post.content %}
{{ blog_post.description_from_content|safe }}
{% endeditable %}
{% endblock %}
    <div class="bottom-article">
		{% block blog_post_list_post_metainfo %}
		{% editable blog_post.publish_date %}
		<ul class="meta-post">
		<li><i class="icon-calendar"></i><a href="#"> {% blocktrans with sometime=blog_post.publish_date|timesince %}{{ sometime }} ago{% endblocktrans %}</a></li>
		{% with blog_post.user as author %}
		<li><i class="icon-user"></i><a href="{% url "blog_post_list_author" author %}"> {{author.get_full_name|default:author.username}}</a></li>
		{% endwith %}
		
		{% with blog_post.categories.all as categories %}
			{% if categories %}
			<li><i class="icon-folder-open"></i>
    		{% for category in categories %}
			<a href="{% url "blog_post_list_category" category.slug %}">{{ category }}</a>{% if not forloop.last %}, {% endif %}
			{% endfor %}
			</li>
			{% endif %}
			{% endwith %}
			{% if blog_post.allow_comments %}
    
			{% if settings.COMMENTS_DISQUS_SHORTNAME %}
			<li>
			<i class="icon-comments"></i>
			<a href="{{ blog_post.get_absolute_url }}#disqus_thread"
				data-disqus-identifier="{% disqus_id_for blog_post %}">
				{% trans "Comments" %}
			</a>
			{% else %}
			<a href="{{ blog_post.get_absolute_url }}#comments">
			{% blocktrans count comments_count=blog_post.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %}
			</a>
			{% endif %}
			</li>
			{% endif %}
		
		</ul>
			{% block read_more%}
			<a class="pull-right" href="{{ blog_post.get_absolute_url }}">Continue reading <i class="icon-angle-right"></i></a>
			{% endblock %}
		{% endeditable %}
		{% endblock %}
	</div>

	</article>
     {% endblock %}
{% endfor %}

{% pagination_for blog_posts %}

{% if settings.COMMENTS_DISQUS_SHORTNAME %}
{% include "generic/includes/disqus_counts.html" %}
{% endif %}

{% endblock %}

</div><!-- END MAIN -->

<div class="col-md-{% block right_col_size %}4{% endblock %}">
{% block right_panel %}
{% include "blog/includes/filter_panel.html" %}
{% endblock %}
</div>